<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link rel="stylesheet" href="/element.css">
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        html,body{
            width: 100%;
            height: 100%;
        }
        #app{
            width: 100%;
            height: 100%;
        }
        .container{
            width: 100%;
            height: 100%;
            display: flex;
        }
        .area-tree{
            flex: 1;
            padding: 20px;
            border-right: 1px solid #0079fe;
        }
        .other-content{
            flex: 4;
            padding: 20px;
        }
    </style>
</head>
    <body>
        <div id="app">
            <div class="container">
                <div class="area-tree">
                    <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
                </div>
                <div class="other-content">
                    其他内容区域
                </div>
            </div>

        </div>

    </body>
    <script src="/vue.js"></script>
    <script src="/axios.min.js"></script>
    <!-- import JavaScript -->
    <script src="/element.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: function() {
                return {
                    visible: false,
                    data: [],
                    defaultProps: {
                        children: 'children',
                        label: 'label'
                    }
                }
            },
            created(){
                console.log('创建...')
                this.getAreaTree()
            },
            methods:{
                getAreaTree(){
                    axios.get("/area/tree")
                        .then(({data}) => {
                            console.log('data:',data)
                            this.data=data
                        })
                        .catch(err => {
                            this.$message.error(err)
                        })

                },
                handleNodeClick(data){
                    console.log('处理节点点击事件...',data)
                }
            }
        })
    </script>
</html>